package com.kh.pajx.sop.dao.order.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.kh.pajx.sop.base.BaseDaoImpl;
import com.kh.pajx.sop.dao.order.IReplaceCardOrderRelationDao;
import com.kh.pajx.sop.domain.order.ReplaceCardOrderRelation;

/**
 * 补卡单据扩展信息数据持久化操作实现类
 * @author:	azzcsimp
 * @Createdate:	2014年12月8日 下午6:58:50
 */
@Repository
public class ReplaceCardOrderRelationDaoImpl extends BaseDaoImpl<ReplaceCardOrderRelation> implements
		IReplaceCardOrderRelationDao {

	@Override
	public ReplaceCardOrderRelation getMarryRelationByRcoId(String rcoId) throws Exception {
		return (ReplaceCardOrderRelation) getSession().createQuery(//
				"FROM ReplaceCardOrderRelation rel WHERE rel.rcoId=? AND rel.relationStatusFlag='1' ")
				.setParameter(0, rcoId).uniqueResult();
	}

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	@Override
	public List<ReplaceCardOrderRelation> getOrderRelationsByRcoId(String rcoId) throws Exception {
		return this.getSession().createQuery("From ReplaceCardOrderRelation where rcoId=? order by dealTime desc")
				.setParameter(0, rcoId).list();
	}

}
